<?php $order = $this->order;?>

<table cellspacing="0" class="a-right small-text vertical-top no-border no-padding margin-top"> 
    <tr>
        <td>
            <div id="logo">
                <a href="<?php echo $this->href('index')?>">
                    <?php echo $this->image('logo.gif') ?>
                </a>
            </div>
        </td>
        <td>
            <?php echo $this->translate('sales')->__('Phone')?> : <?php echo $order['company']['phone'] ?><br/>
            <?php echo $this->translate('sales')->__('Fax')?> : <?php echo $order['company']['fax'] ?><br/>
            <?php echo $order['company']['email'] ?>
        </td>
        <td>
            <?php echo $order['company']['name'] ?><br/>
            <?php echo $order['company']['street_address'] ?><br/>
            <?php echo $order['company']['city'] ?><br/>
            <?php echo $order['company']['zone'] ?><br/>
            <?php echo $order['company']['country'] ?><br/>
            <?php echo $order['company']['postcode'] ?><br/>
        </td>
    </tr>
</table>
<!-- <br/> -->
<table cellspacing="0" class="two-columns"> 
    <tr class="dark-brown">
        <th colspan="2">
            <!-- @todo invoice Id -->
            <?php echo $this->translate('sales')->__('Order')?> # <?php 
            echo $order['number'] ?> :: <?php echo $this->translate('sales')->__('Order Date')?>: <?php
            echo Ecart_Date::timestamp(strtotime($order['date_purchased_on']))
                ->toPhpString("D M j Y") ?><br/>
        </th>
    </tr>
    <tr class="brown upper-text">
        <th><?php echo $this->translate('sales')->__('Sold to');?></th>
        <th><?php echo $this->translate('sales')->__('Ship to');?></th>
    </tr>
    
    <tr>
        <td>
            <?php echo $this->address($order['billing']) ?>
        </td>
        <td>
            <?php echo $this->address($order['delivery']) ?>
        </td>
    </tr>
    <tr class="no-border">
        <td colspan="2"></td>
    </tr>
   
    <tr class="brown">
        <td><?php echo $this->translate('sales')->__('Payment Method');?></td>
        <td><?php echo $this->translate('sales')->__('Shipping Method');?></td>
    </tr>
    <tr class="no-bottom-border">
        <td>
            <?php echo $order['payment_method'] ?>
        </td>
        <td>
            <?php echo $order['shipping_method'] ?><br/>
            (<?php echo $this->translate('sales')->__('Total Shipping Charges') . ' ' . $this->currency($order['shipping'])?>)
        </td>
    </tr>
    <tr class="no-top-border">
        <td>
            <?php echo $this->paymentForm($this->order['payment_method_code'], 'view');?><br/>
        </td>
        <td>
            <?php echo $this->shippingForm($this->order['shipping_method_code'], 'view');?><br/>
        </td>
    </tr>
    
</table>
<table cellspacing="0" class="four-columns  margin-top">
    <tr class="brown">
        <td><?php echo $this->translate('sales')->__('QTY');?></td>
        <td><?php echo $this->translate('sales')->__('Products');?></td>
        <td><?php echo $this->translate('sales')->__('SKU');?></td>
        <td><?php echo $this->translate('sales')->__('Subtotal');?></td>
    </tr>
    <?php foreach ($order['products'] as $product) : ?>
        <tr>
            <td><?php echo $product['quantity'] ?></td>
            <td><?php echo $product['name'] ?>
            <?php if (isset($product['attributes'])): ?>
                <br/>
                <?php
                foreach ($product['attributes'] as $attribute) {
                    echo $attribute['product_option'] . ': '
                       . $this->escape($attribute['product_option_value']) . "<br />\n";
                }?>
                
            <?php endif; ?>
            </td>
            <td><?php echo $this->escape($product['sku']) ?></td>
            <td><?php echo $this->currency($product['quantity'] * $product['final_price']) ?></td>
        </tr>
    <?php endforeach; ?>
</table>

<table cellspacing="0" class="a-right no-border no-padding margin-top">
    <?php foreach ($order['totals'] as $total) :?>
        <tr>
           <td><?php echo Ecart::translate('sales')->__($total['title'])?>:</td>
           <td><?php echo $this->currency($total['value'])?></td>
        </tr>
    <?php endforeach;?>
    <tr>
        <td><?php echo $this->translate('sales')->__('Total');?> :</td>
        <td><?php echo $this->currency($order['order_total']) ?></td>
    </tr>
</table>